
<%@page import="java.sql.*"%>
<%@page import="javax.sql.*"%>
<%@page import="javax.naming.*"%>
<%@ page import="com.sun.xml.internal.ws.commons.xmlutil.Converter" %>
<%@ page import="com.xxx.entity.User" %>
<%@ page import="com.xxx.DAO.userDao" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.xxx.util.Md5Util" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%request.setCharacterEncoding("utf-8"); %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>注册成功页面</title>
</head>
<body>
<%
	String name=request.getParameter("name").trim();//去除首尾空格
	String password= Md5Util.encodePwdByMd5(request.getParameter("password")).trim();
	String refill=Md5Util.encodePwdByMd5(request.getParameter("refill")).trim();
	userDao dao=new userDao();
	List<User> userList=new ArrayList();
	userList=dao.select(name,password);
	if (userList.isEmpty()){
		if(password.equals(refill)){
			dao.add(name,password);
			response.sendRedirect("Register.jsp?err=3");
		}else{
			response.sendRedirect("Register.jsp?err=2");
		}
	}else{
		response.sendRedirect("Register.jsp?err=1");
	}
%>
</body>
</html>